package com.itheima.d07_io_byte_copyfile;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * 目标：完成文件拷贝案例
 */
public class Test2 {

    public static void main(String[] args) throws Exception {
        //需求：拷贝D:\imgs\ikun合集.zip 到C:\Users\单笑\Pictures\kun.zip中

        //FileUtil
        FileUtil.copy("D:\\imgs\\ikun合集.zip",
                "C:\\Users\\单笑\\Pictures\\kun2.zip", true);

        //IoUtil
        IoUtil.copy(new FileInputStream("D:\\imgs\\ikun合集.zip"),
                new FileOutputStream("C:\\Users\\单笑\\Pictures\\kun3.zip"));

        System.out.println("拷贝完毕！");
    }

}
